
var business = cookie.get('business') ? cookie.get('business') : {};



// 验证用户是否登录

(async function () {
    if (business == '{}') {
        mui.toast('请先登录，谢谢')

        setTimeout(() => {
            location.href = 'login.html'

        }, 1000)


    }

    business = JSON.parse(business)
    let data = {
        id: businessid.id,
        mobile: business.mobile
    }
    let result = await ({ url: 'business/check', params: data })

    if (result.code == 0) {
        cookie.clear();
        setTimeout(() => {
            location.href = "login.html"
        }, 1000)
    }


    //存储用户数据
    cookie.set('business', JSON.stringify(result.data))
})

function getParam(name) {
    let query = decodeURI(location.search.slice(1));

    if (query) {
        let vars = query.split('&');
        if (vars.length > 0) {
            for (let val of vars) {
                let pair = val.split('=');

                if (pair.length > 0) {   //长度判断  防止  = 号
                    if (pair[0] == name) { return pair[1] }
                }
            }
        }
    }
    return null;
}









